package com.fsc.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fsc.entity.domain.ChatRecord;
import com.fsc.entity.dto.ChatGetGHistoryDTO;
import com.fsc.entity.dto.ChatGetPHistoryDTO;
import com.fsc.entity.vo.GChatRecordVO;
import com.fsc.entity.vo.MessageTmpVO;
import com.fsc.entity.vo.PChatRecordVO;
import com.fsc.service.ChatRecordService;
import com.fsc.mapper.ChatRecordMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.*;

/**
* @author 86183
* @description 针对表【chat_record(聊天内容表)】的数据库操作Service实现
* @createDate 2024-06-02 13:15:21
*/
@Service
public class ChatRecordServiceImpl extends ServiceImpl<ChatRecordMapper, ChatRecord>
    implements ChatRecordService{
    @Resource
    private ChatRecordMapper chatRecordMapper;
    //获取私聊记录，一次10条
    @Override
    public List<PChatRecordVO> getPHistory(ChatGetPHistoryDTO chatGetPHistoryDTO) {
        return chatRecordMapper.getHistory(chatGetPHistoryDTO);
    }

    @Override
    public MessageTmpVO getMsgTmp(Integer id,Integer sendId) {
        if(sendId!=null){
            return chatRecordMapper.getPersonMsg(id,sendId);
        }
        else return chatRecordMapper.getGroupMsg(id);
    }

    @Override
    public List<GChatRecordVO> getGHistory(ChatGetGHistoryDTO chatGetGHistoryDTO) {
        return chatRecordMapper.getGHistory(chatGetGHistoryDTO);
    }


}




